Include label_command labels in create_labels label collection#31159
Merged
Include label_command labels in create_labels label collection#31159
label_command labels in create_labels label collection#31159Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
Include label_command labels in create_labels admin command
Include May 9, 2026
label_command labels in create_labels label collection
Copilot created this pull request from a session on behalf of
pelikhan
May 9, 2026 04:59
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes create_labels label discovery by expanding compile-time JSON label aggregation to include on.label_command trigger labels, preventing missing-label scenarios during admin label creation.
Changes:
- Expanded
extractSafeOutputLabelsto collect labels fromWorkflowData.LabelCommandin addition to safe-outputs label sources. - Adjusted nil-handling so label extraction still works when
SafeOutputsis absent. - Added unit tests for inclusion and cross-source deduplication behavior.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/compile_workflow_processor.go | Extends label aggregation to include label_command labels and updates related comments/nil-handling. |
| pkg/cli/compile_workflow_processor_test.go | Adds unit tests validating inclusion of label_command labels and deduplication across sources. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
pkg/cli/compile_workflow_processor_test.go:13
- The primary bug scenario described in the PR is workflows that use
on.label_commandbut have nosafe-outputsconfig (i.e.,SafeOutputsis nil). The current tests only cover cases whereSafeOutputsis non-nil. Add a test that setsSafeOutputs: nilandLabelCommand: []string{"deploy"}and asserts the label is still returned.
func TestExtractSafeOutputLabels_IncludesLabelCommand(t *testing.T) {
data := &workflow.WorkflowData{
SafeOutputs: &workflow.SafeOutputsConfig{
CreateIssues: &workflow.CreateIssuesConfig{
Labels: []string{"bug"},
- Files reviewed: 2/2 changed files
- Comments generated: 2
Comment on lines
+1
to
+2
| package cli | ||
|
|
Comment on lines
+158
to
162
| // extractSafeOutputLabels collects all unique labels referenced by workflow configuration | ||
| // that should exist in the repository for the workflow to function correctly. | ||
| // Scans: safe-outputs labels (create-issue/create-discussion/create-pull-request/add-labels) | ||
| // and on.label_command trigger labels. | ||
| func extractSafeOutputLabels(data *workflow.WorkflowData) []string { |
Collaborator
|
@copilot Merge main and recompile |
…command-collecting-labels Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
origin/maininto this branchmake recompile